package Model

import "time"

type Employee struct {
	itsEmpid int
	itsName string
	itsAddress string
	itsClassification PaymentClassification
	itsSchedule PaymentSchedule
	itsPaymentMethod PaymentMethod
	itsAffiliation Affiliation
}

func (em* Employee)SEmployee(empid int,name string,address string) *Employee{
	return &Employee{itsEmpid: empid, itsName: name, itsAddress: address}
}

func (em* Employee)SetClassification(pc PaymentClassification) {
	em.itsClassification = pc
}

func (em* Employee)SetSchedule(ps PaymentSchedule) {
	em.itsSchedule = ps
}

func (em* Employee)SetMethod(pm PaymentMethod) {
	em.itsPaymentMethod = pm
}

func (em* Employee)GetName() string {
	return em.itsName
}

func (em* Employee) GetClassification() PaymentClassification {
	return em.itsClassification
}

func (em* Employee) GetSchedule() PaymentSchedule {
	return em.itsSchedule
}

func (em* Employee) GetMethod() PaymentMethod {
	return em.itsPaymentMethod
}

func (em* Employee) SetAffiliation(af Affiliation) {
	em.itsAffiliation = af
}

func (em* Employee) GetAffiliation() Affiliation {
	return em.itsAffiliation
}

func (em* Employee) GetEmpid() int {
	return em.itsEmpid
}

func (em* Employee) SetName(name string) {
	em.itsName = name
}

func (em* Employee) SetAddress(address string) {
	em.itsAddress = address
}

func (em* Employee) GetAddress() string {
	return em.itsAddress
}

func (em *Employee) IsPayData(payDate time.Time) bool {
	return em.itsSchedule.IsPayData(payDate)
}

func (em* Employee) GetPayPeriodStartDate(payPeriodEndDate time.Time) time.Time {
	return em.itsSchedule.GetPayPeriodStartDate(payPeriodEndDate)
}

func (em* Employee) Payday(pc Paycheck) {
	grossPay := em.itsClassification.CalculatePay(pc)
	deductions := em.itsAffiliation.CalculateDeductions(pc)
	netPay := grossPay - deductions
	pc.SetGrossPay(grossPay)
	pc.SetDeduction(deductions)
	pc.SetNetPay(netPay)
	em.itsPaymentMethod.Pay(pc)
}